"use strict";

exports.__esModule = true;
exports.mComponent = mComponent;

var _mixin = require("./mixin");

var _object = require("../object");

function bindAttached(self, options) {}

function bindDetached(self, options) {}

function mComponent(mix) {
    var _s = (0, _object.omitByKeys)(mix, ['attached', 'detached']);
    _s = Object.assign({}, _s, (0, _object.omitByKeys)(Object.getPrototypeOf(mix), ['constructor', 'attached', 'detached']));
    _s = Object.assign({}, _s, _s.exports);

    if (mix && mix.mixins) {
        mix.mixins.forEach(function (mixinkey) {
            var _mix = (0, _mixin.getMixin)(mixinkey) || {};
            _s.data = Object.assign({}, _s.data, _mix.data);
            _s.properties = Object.assign({}, _s.properties, _mix.properties);
            _s.methods = Object.assign({}, _s.methods, _mix.methods);
        });
    }

    var def = Object.assign(_s, {
        attached: function attached() {
            var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

            var self = this;
            self.$opt = options;
            bindAttached.apply(undefined, [self].concat(options));
            mix.attached && mix.attached.apply(this, options);
        },
        detached: function detached() {
            var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

            var self = this;
            bindDetached.apply(undefined, [self].concat(options));
            mix.detached && mix.detached.apply(this, options);
        }
    });
    Component(def);
}